<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>HUI</title>
<link rel="stylesheet" type="text/css" href="../css/hui.css" />
</head>
<body>
<header class="hui-header">
    <div id="hui-back"></div>
    <h1>HUI </h1>
</header>
<div class="hui-wrap">
	<div class="hui-common-title" style="margin-top:15px;">
		<div class="hui-common-title-line"></div>
		<div class="hui-common-title-txt">APP中存在的窗口</div>
		<div class="hui-common-title-line"></div>
	</div>
	<div class="hui-text hui-text-center" style="padding:15px 20px; background:#FFFFFF; margin-top:15px;">左滑可以关闭窗口 ^_^</div>
	<div id="viewslist"></div>
</div>
<script src="../js/hui.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
hui.loading('加载窗口');
hui.plusReady(function(){
	var views = hui.allViews();
	console.log(JSON.stringify(views));
	var html  = '';
	for(var k = 0; k < views.length; k++){
		html += '<div class="hui-swipe-do">'+
		'<div class="hui-swipe-do-doms">'+
			'<div class="hui-swipe-do-content">'+
				'<div style="padding-left:12px; line-height:60px;">'+views[k].id+'</div>'+
			'</div>'+
			'<div class="hui-swipe-do-btn" onclick="removeDom(this,\''+views[k].id+'\');">删除</div>'+
		'</div>'+
	'</div>';
	}
	hui('#viewslist').html(html);
	hui.swipeDo();
	hui.closeLoading();
});
function removeDom(cdom, vid){
	console.log(vid);
	var view = hui.getViewById(vid);
	var dDom = hui(cdom).parent().parent();
	dDom.hide(true);
	setTimeout(function(){
		dDom.remove();
		plus.webview.close(view, 'slide-out-right');
	}, 300);
}
</script>
</body>
</html>